#include "common/common_test.h"
#include "memory/MemoryObject.h"

namespace UT {
namespace utils {

using MemoryObject = chelper::memory::MemoryObject;

class TestMemory_block : public Common {
  public:
    TestMemory_block() = default;
    ~TestMemory_block() = default;
};

class Block {
	public:
		int getVal() const {
			return val_;
		}
		void setVal(int val) {
			val_ = val;
		}
	private:
		int val_;
};

TEST_F(TestMemory_block, common) { 
    const uint64_t MEMORY_SIZE = 1024 * 1024;
	MemoryObject::init(MEMORY_SIZE);

	Block *block = MemoryObject::CreateObject<Block>();
	block->setVal(10);
	EXPECT_EQ(block->getVal(), 10);

	// MemoryObject::Destroy<Block>(block);

	MemoryObject::free();
}

}  // namespace utils
}  // namespace UT